<template>
  <div class="list-wrap">
    <div class="search-result-list">
      <a-table
        :columns="columns"
        :dataSource="logsData"
        rowKey="id"
        :loading="loading"
        :pagination="pagination"
      >
      </a-table>
      <pagination
        :total="total"
        @loadDataList="initPageList"
        ref="pageBand"
      />
    </div>
  </div>
</template>
<script>
import { mblogin } from '../../store/action.js'
export default {
  name: 'ProviderRechargeRecord',
  data() {
    return {
      columns: [
        {
          dataIndex: 'index',
          title: '序号',
          fixed: 'left',
          width: 60
        },
        {
          title: '时间',
          dataIndex: 'created_at'
        },
        {
          title: '用户名',
          dataIndex: 'member'
        },
        {
          title: 'IP',
          dataIndex: 'ip'
        },
        {
          title: '模块',
          dataIndex: 'modules'
        },
        {
          title: '动作',
          dataIndex: 'actions'
        },
        {
          title: '结果',
          dataIndex: 'result'
        },
        {
          title: '消息',
          dataIndex: 'message'
        }
      ],
      logsData: [],
      loading: false,
      pagination: false,
      // scrollX: {},
      total: 0
    }
  },
  methods: {
    initPageList(info) {
      this.loading = true
      mblogin({
        page: info.page,
        num: info.pageSize
      }).then(res => {
        this.loading = false
        this.logsData = res.data.list
        for (let i = 0; i < res.data.list.length; i++) {
          this.logsData[i].modules = '会员鉴权'
          this.logsData[i].actions = '登录'
          this.logsData[i].result = '成功'
          this.logsData[i].message = '登录成功'
          this.logsData[i]['index'] = (info.page - 1) * info.pageSize + (i + 1)
        }
        // console.log(this.logsData)
        this.total = res.data.total_num
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.ant-table-wrapper{
  margin-top: 0;
}
</style>
